package org.qf.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Calendar;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "users")
public class User {
    @Id
    @KeySql(useGeneratedKeys = true)
    private String id;

    private String username;

    private String userpassword;

    private String gender;

    private String birthday;

    private String phone;

    private String address;

    private String userrole;

    private String createdby;

    private String creationdate;

    private String modifyby;

    private String modifydate;
    @Transient
    //忽略映射
    private Integer age;
//    //年龄
//    public Integer getAge() { //计算年龄
//        Calendar newDate=Calendar.getInstance();
//        Calendar birth=Calendar.getInstance();
//        birth.setTime(new Date(birthday));
//        setAge(newDate.get(Calendar.YEAR)- birth.get(Calendar.YEAR));
//        return newDate.get(Calendar.YEAR)- birth.get(Calendar.YEAR);
//    }
}